<link href="/css/indexPage.css" media="screen" rel="stylesheet" type="text/css">

<!-- Cover image for the tournament -->
<div class="row plovdivPic"></div>

<!-- Board with the winners and throphies from tournament -->
<section id="winners" style="display:none;">
    <h3 style="text-shadow: 1px 1px 0px black;">WINNERS AND TROPHIES FROM TOURNAMENT</h3>
    <section>
        <article>
            <h5>BEST SCORER</h5>
            <div id="goalMyster">
                <figure class="cup">
                    <img src="/img/goalmaistor.png"/>
                </figure>
                <figure class="player">
                    <img src=""/>
                    <span></span>
                </figure>
            <div>
        </article>
        <article>
            <h5>SECOND PLACE</h5>
            <div id="secondPlace">
                <figure class="cup">
                    <img src="/img/secondPlaceCup.png"/>
                </figure>
                <figure class="player">
                    <img src="/img/playersPicture/Desislava%20Damyanova.jpg"/>
                    <span>Desislava Damyanova</span>
                </figure>
            <div>
        </article>
        <article>
            <h5>FIRST PLACE</h5>
            <div id="firstPlace">
                <figure class="cup">
                    <img src="/img/winnerCup.png"/>
                </figure>
                <figure class="player">
                    <img src="/img/playersPicture/Mihail%20Merkov.jpg"/>
                    <span>Mihail Merkov</span>
                </figure>
            <div>
        </article>
        <article>
            <h5>THIRD PLACE</h5>
            <div id="thirdPlace">
                <figure class="cup">
                    <img src="/img/thirdPlace.png"/>
                </figure>
                <figure class="player">
                    <img src="/img/playersPicture/Ivan%20Slavchev.jpg"/>
                    <span>Ivan Slavchev</span>
                </figure>
            <div>
        </article>
    </section>
</section>

<!-- Column with top news -->
<div class="row" style="margin: 30px auto 0 auto;">

    <div class="span3" style="text-align: justify;">
        <h3 style="text-shadow: 1px 1px 0px black; font-size: 22px;">Terms of the tournament</h3>
        <p style="color: #9e9e9e;">The tournament will be held with 13 players divided into 4 groups (distribution of players in each group will be made in a formal drawing in the presence of everyone)...</p>
        <p><a class="btn btn-info" href="#terms" data-toggle="modal">See more</a></p>
    </div>

    <div class="span6" style="text-align: justify;">
        <h3 style="text-shadow: 1px 1px 0px black;">Table of last games</h3>
        <p style="color: #9e9e9e;">View last played games. The results of yesterday's matches, as well as which games should be played.</p>
        <p>
            <div style="text-align: center;">
                <h3>Games today</h3>
                <section class="matchesToday">
                </section>
                <h3>Games yesterday</h3>
                <section class="matchesYesterday">
                </section>
            </div>
        </p>
    </div>

    <div class="span3" style="text-align: justify;">
        <h3 style="text-shadow: 1px 1px 0px black;">News</h3>
        <p style="color: #9e9e9e;"></p>
        <a class="btn btn-danger" href="#history" data-toggle="modal">See the winners from previous tournament</a>
   </div>

</div>

<!-- Modal dialog for terms of the tournament -->
<div id="terms" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">Terms of the tournament</h3>
    </div>
    <div class="modal-body" style="text-align: justify;">
        <p>The tournament will be held with 13 players divided into 4 groups (distribution of players in each group will be made in a formal drawing in the presence of everyone). The top two players from each group will face each other in  quarterfinals and the semifinals, in which the winners from the semifinals of these matches will play the final of the tournament for the first and second place. The other two players from the semifinals will play for third place.</p>
        <p>&nbsp;Each player in the group stage will play just one match with his opponent in the same group. Winners add 1 point; defeated players do not lose points. The final standings in the group are determined by the following criteria:</p>
        <ol>
            <li>First ranks the player with the most points in the group stage. If there are two players with equal scores, the best player will be defined by the following criteria:</li>
            <li>First ranks the player with the greatest positive difference between made/ received points during the matches in the group stage. If there are two players with equal positive difference and an equal number of points, the best player will be defined by the following criteria:</li>
            <li>Ranked first will be the winner of the match between the two players.</li>
        </ol>
        <p>In the semifinal matches the winner of one group will face the player in second place in the other group and vice versa.</p>
        <p>The two defeated players from the semifinals will play for third place.</p>
        <p>The winners of the semifinals will play for first and second place of the tournament.</p>
        <p>&nbsp;</p>
        <p><strong>* For each match in the tournament is considered playing 2 of 3 games to 21 points.</strong></p>
        <p>&nbsp;</p>
        <p><strong>The schedule of the games in the tournament</strong></p>
        <p>Every night will be determined the matches for the following day (depending on the convenience of the time for the players).</p>
        <p>&nbsp;</p>
        <p>Two matches will be played in each group, every day.</p>
        <p>The two matches for the semi-finals will be played in 1 day.</p>
        <p>The final match and the match for the third place will be played in two days.</p>
        <p>The ceremony of the tournament will be held on the next business day after playing the final.</p>
        <p><strong>* Matches will be held after 17:00 due to consideration not to hinder the work of colleagues.</strong></p>
    </div>
    <div class="modal-footer">
        <button class="btn closeBtn" data-dismiss="modal" aria-hidden="true">Close</button>
    </div>
</div>

<!-- Modal dialog for winners -->
<div id="history" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width: 750px; margin-left: -375px;">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">Winners from Table Tennis Tournament Plovdiv 2013</h3>
    </div>
    <div class="modal-body" style="text-align: justify; max-height: 555px;">
        <img src="../img/plovdiv.jpg"/>
        <table>
            <thead>
                <td>BEST SCORER</td>
                <td>SECOND PLACE</td>
                <td>FIRST PLACE</td>
                <td>THIRD PLACE</td>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <figure class="cup">
                            <img src="/img/goalmaistor.png"/>
                        </figure>
                        <figure class="player">
                            <img src="/img/playersPicture/Mihail%20Merkov.jpg"/>
                            <span>Mihail Merkov</span>
                        </figure>
                    </td>
                    <td>
                        <figure class="cup">
                            <img src="/img/secondPlaceCup.png"/>
                        </figure>
                        <figure class="player">
                            <img src="/img/playersPicture/Mihail%20Merkov.jpg"/>
                            <span>Mihail Merkov</span>
                        </figure>
                    </td>
                    <td>
                        <figure class="cup">
                            <img src="/img/winnerCup.png"/>
                        </figure>
                        <figure class="player">
                            <img src="/img/playersPicture/Ivan%20Slavchev.jpg"/>
                            <span>Ivan Slavchev</span>
                        </figure>
                    </td>
                    <td>
                        <figure class="cup">
                            <img src="/img/thirdPlace.png"/>
                        </figure>
                        <figure class="player">
                            <img src="/img/playersPicture/Nikolai%20Petkov.jpg"/>
                            <span>Nikolai Petkov</span>
                        </figure>
                    </td>
                </tr>
            </tbody>
        </table>
        <h4 style="text-align: center">Below you can watch the matches for first and third place on previous tournament</h4>
        <iframe width="345" height="315" src="//www.youtube.com/embed/d07v5WK-8RM?rel=0" frameborder="0" allowfullscreen></iframe>
        <iframe width="345" height="315" src="//www.youtube.com/embed/Jmt5AqV7IOU?rel=0" frameborder="0" allowfullscreen></iframe>
    </div>
    <div class="modal-footer">
        <button class="btn closeBtn" data-dismiss="modal" aria-hidden="true">Close</button>
    </div>
</div>

<script type="text/javascript">
    jQuery(document).ready(function() {
        var matchService = new TennisTour.Service.MatchesService();
        var playerService = new TennisTour.Service.PlayerService();
        var index = jQuery.evalJSON('<?php echo $this->index; ?>');
        matchService.playedMatches(index.matches);
        playerService.showWinners(index.winners);
    });
</script>